module.exports = app => {
    const {router, middleware} = app;

    router.get('/api/home', middleware.api(), async ctx => {
        let notify = await app.model.Message.scope('notify').findOne({
            limit: 1,
            order: [['id', 'desc']],
            include: [{model: app.model.User.unscoped(), as: 'from', attributes: ['username']}]
        });
        ctx.body = {notify};
    });
};